FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
    build-essential \
    qt6-base-dev \
    qt6-base-dev-tools \
    qt6-charts-dev \
    libmysqlclient-dev \
    libgtest-dev \
    cmake && \
    rm -rf /var/lib/apt/lists/*

# 安装 gtest
RUN cd /usr/src/gtest && cmake . && make && cp *.a /usr/lib

WORKDIR /app

COPY . /app

RUN qmake6 -o Makefile haolingqixiang.pro && make

# 编译并运行测试
RUN g++ -o tests/test_runner tests/tst_log.cpp -lgtest -lgtest_main -pthread
RUN ./tests/test_runner

EXPOSE 8070

CMD ["./haolingqixiang"]
